<?php /*
	
*/ ?>
<?php include("system/config.inc.php");
$donotinclude = 1;
if(!isset($_SESSION['adminuserid']))
{
	header("location:index.php?msg=logfirst");
	die();
}


if(isset($_REQUEST['submit']) && trim($_REQUEST['submit'])=="Change")
{
	$adminid=$_REQUEST["id"];
	
	if ($_REQUEST['con_pass']==$_REQUEST['new_pass']) {
	
		$newpass=md5($_REQUEST['new_pass']);
		
			$sql_upd=" UPDATE `tbladmin` SET 
			`varpassword` = '$newpass'
			WHERE `intid`='$adminid'";
			mysql_query($sql_upd);
			header("Location:admin.php");
	} else {
		$msg = "Your new passwords did not match please re-enter the passwords ensuring that they are both spelt identically";
	}
}
?>
<script type="text/javascript">

function validation()
{
	if(document.change.new_pass.value=="")
	{
		alert("Please Enter New Password..!")
		document.change.new_pass.focus();
		return false;
	}
	if(document.change.new_pass.value!=document.change.con_pass.value)
	{
		alert("Confirm Password is Not Match to the New Password..!")
		document.change.con_pass.focus();
		return false;
	}
}
</script>
<?php include("inc/header.php");?>
<body>
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center" class="middlebackground">
  <tr>
    <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php include(INC."top.inc.php");?></td>
      </tr>
      <tr>
        <td height="500" valign="top" >
			<div align="center"><?php echo $msg;?></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="300" align="left" class="style12" style="padding:15px;"><table width="353" border="0" align="center" cellpadding="5" cellspacing="5" class="border" bgcolor="#FFFFFF">
          <tr>
            <td width="331" height="30" align="center" bgcolor="#000000" class="fntstyle"> Change Password</td>
          </tr>
          <tr>
			<td style="padding-left:10px; padding-right:10px;"><form method="post" name="change" id="change" action="changepassword.php?id=<?php echo $_REQUEST['id'];?>">
                <table  border="0" cellspacing="5" cellpadding="0">
                    <tr>
                      <td class="font" >New Password : </td>
                      <td><input name="new_pass" type="password" id="new_pass" size="25" /></td>
                    </tr>
                    <tr>
                    <td class="font" >Confirm Password  : </td>
                    <td><input name="con_pass" type="password" id="con_pass" size="25" />                    </td>
                  </tr>
                  
                  <tr>
                    <td colspan="2" class="style15">&nbsp;</td>
                    </tr>
                  <tr>
                    <td colspan="2" align="center"><input name="submit" type="submit" class="btnbg" value="Change" onClick="return validation();" border="0" />                    </td>
                    </tr>
                </table>
            </form></td>
          </tr>
        </table> </td>
          </tr>
        </table></td>
      </tr>
      
    </table></td>
  </tr>
</table></td>
  </tr>
</table>

</body>
</html>
